package
{
	
	import custom_event.NavigationEvent;
	
	import starling.display.Button;
	import starling.display.Image;
	import starling.display.Sprite;
	import starling.events.Event;
	
	public class IntroSplashScreen extends Sprite
	{
		public function IntroSplashScreen()
		{
			super();
			this.addEventListener(starling.events.Event.ADDED_TO_STAGE, onAddedToStage);
		}
		
		private var test:Image;
		private var startButton:Button;
		private function onAddedToStage(event:Event):void {
			test = new Image(Assets.getTexture("TestImage"));
			this.addChild(test);
			
			startButton =  new Button(Assets.getTexture("TouchToStart"));
			startButton.x = 50;
			startButton.y = 100;
			this.addChild(startButton);
			
			this.addEventListener(Event.TRIGGERED, onSplashScreenClick);
			
			Assets.getEmeddedWordList();
		}
		
		private function onSplashScreenClick(event:Event):void
		{
			if ((event.target as Button) == startButton) {
				this.dispatchEvent(new NavigationEvent(NavigationEvent.CHANGE_SCREEN,true,{id:"go to main menu"}));
				trace("go to main menu");
			}
		}
		
		public function off():void
		{
			this.visible = false;
			
		}
		
		public function on():void
		{
			this.visible = true;
			
		}
	}
}